package com.struts;

import com.dao.UserBiz;
import com.dao.impl.UserBizImpl;
import com.entity.User;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class UserAction extends ActionSupport{
 private UserBiz userBiz=new UserBizImpl();
// private String uname;
// private String upass;
 private User item=new User();
 public User getItem() {
	return item;
}
public void setItem(User item) {
	this.item = item;
}
public String login(){
	 User user=userBiz.login(item.getUname(), item.getUpass());
	 if(user==null){
		 return "loginFail";
	 }else{
		 ActionContext.getContext().getSession().put("USER", user);
		 return "loginSuccess";
	 }
 }
public String logout() throws Exception{
	ActionContext.getContext().getSession().remove("USER");
	return "logoutSuccess";
	
}
// public void setUpass(String upass){
//	 this.upass=upass;
// }
// public String getUpass(){
//	 return upass;
// }
// public void setUname(String uname){
//	 this.uname=uname;
// }
// public String getUname(){
//	 return uname;
// }
 public void setUserBiz(UserBiz userBiz){
	 this.userBiz=userBiz;
 }
 public UserBiz getUserBiz(){
	 return userBiz;
 }
}

